/**
 * Written by Timbot
 * V1.0, June 2007
 */
package com.as3.timbot.data.iterators
{
	import com.as3.timbot.data.iterators.IIterator;
	/**
	* Iterates through Arrays in reverse to retrieve data
	*/
	public class ArrayReverseIterator implements IIterator
	{
		private var _index:uint = 0;
		private var _collection:Array;
		
		public function ArrayReverseIterator(collection:Array)
		{
			_collection = collection;
			reset();
		}
		public function reset():void
		{
			_index = _collection.length - 1;
		};
		public function next():Object
		{
			return _collection[_index--];
		};
		public function hasNext():Boolean
		{
			return _index >= 0;
		};
	}
}